import { createRouter, createWebHistory } from 'vue-router'
import { ElMessage } from 'element-plus'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    //直接跳到后台登录页面
    { path:'/',redirect: '/login'},
    { 
        path: '/login',
        meta: { title: '超级管理端登录页面' }, 
        component: () => import('@/views/Login.vue') 
    },
    {
        path: '/main',
        name: 'Main',
        component: () => import('@/views/operations/main.vue'),
        meta: { title: '超级管理员控制台' },
        children: [
    
            {
                path: 'admin-list',
                component: () => import('@/views/operations/list.vue'),
                meta: { title: '超级管理员控制台-管理员列表' }
            },
            {
                path: 'admin-info/:aid',
                component: () => import('@/views/operations/info.vue'),
                meta: { title: '超级管理员控制台-管理员信息' }
            },
            {
                path: 'update-password',
                component: () => import('@/views/operations/repsw.vue'),
                meta: { title: '超级管理员控制台-修改密码' }
            }
        ]
    },
    {
        path: '/admin/add', 
        component: () => import('@/views/operations/add.vue'),
        meta: { title: '超级管理员控制台-新增管理员' }
    },
    {
        path: '/admin/info/:aid',
        component: () => import('@/views/operations/info.vue'),
        meta: { title: '超级管理员控制台-管理员列表' }
    },
]
})


//导出路由
export default router 